package com.cocotingo.snail.text;

import com.cocotingo.snail.Vector;

public class Rectangle {
	public final Vector position;
	public final Vector size;
	public Rectangle(int x, int y, int w, int h) {
		position = new Vector(x, y);
		size = new Vector(w, h);
	}
	public Rectangle() {
		this(0, 0, 0, 0);
	}
	public Rectangle(Rectangle r) {
		this(r.position.x, r.position.y, r.size.x, r.size.y);
	}
	@Override
	public int hashCode() {
		return position.x + position.y << 8 + size.x << 16 + size.y << 24;
	}
	@Override
	public boolean equals(Object obj) {
		if (obj == null) return false;
		else if (obj instanceof Rectangle) {
			return ((Rectangle) obj).position.equals(position) &&
				((Rectangle) obj).size.equals(size);
		} else return false;
	}
}
